5fd116
@@ -133,9 +133,10 @@
public int run(String[] args) throws IOException, InterruptedException, ClassNot
 
     JobClient jc = new JobClient(new JobConf(job.getConfiguration()));
 
-    Token<DelegationTokenIdentifier> mrdt = jc.getDelegationToken(new Text("mr token"));
-    job.getCredentials().addToken(new Text("mr token"), mrdt);
-
+    if(UserGroupInformation.isSecurityEnabled()) {
+      Token<DelegationTokenIdentifier> mrdt = jc.getDelegationToken(new Text("mr token"));
+      job.getCredentials().addToken(new Text("mr token"), mrdt);
+    }
     String metastoreTokenStrForm = addHMSToken(job, user);
 
     job.submit();
